package ru.cod.rs.object;

import ru.cod.rs.enums.Sides;
import ru.cod.rs.object.actions.LiveActions;
import android.graphics.Bitmap;

/**
 * O����� � �������� ���� ����� �� �����
 * 
 * @author Suslov Vadim
 * 
 */
public class LiveObject extends AnimatedObject implements LiveActions {

	public LiveObject(Bitmap b) {
		super(b);
	}

	public LiveObject(Bitmap b, int abc, int ord) {
		super(b, abc, ord);
	}

	protected int maxHealth;
	protected int health;
	protected Sides side;

	// //////////////////////////////////////////////////////////////////

	public void injure(int i) {
		health -= Math.abs(i);
		if (health <= 0) {
			health = 0;
		}
	}

	public void heal(int i) {
		if (health > 0) {
			health += i;
		}

		if (health > maxHealth) {
			health = maxHealth;
		}
	}

	/**
	 * @return the maxHealth
	 */
	public int getMaxHealth() {
		return maxHealth;
	}

	/**
	 * @param maxHealth
	 *            the maxHealth to set
	 */
	public void setMaxHealth(int maxHealth) {
		this.maxHealth = maxHealth;
		health=this.maxHealth;
	}

	/**
	 * @return the side
	 */
	public Sides getSide() {
		return side;
	}

	/**
	 * @param side
	 *            the side to set
	 */
	public void setSide(Sides side) {
		this.side = side;
	}

	public void setHealth(int h) {
		health = h;
	}

	public int getHealth() {
		return health;
	}
}
